package commClient;

public class AfterDecryption {

	String afterDecryptReply;
	String afterDecryptName;
	String afterDecryptBalanceBTC;
	String afterDecryptBalanceDKK;
	String afterDecryptNewBalanceBTC;
	String afterDecryptNewBalanceDKK;
	String afterDecryptIsTransfered;

	public AfterDecryption(String decryptedmessage) {

		String[] decrypteddata_array = decryptedmessage.split(":");

		if (decrypteddata_array[0].trim().equals("AUTH")) {
			afterDecryptReply = new String(decrypteddata_array[1].trim());

			if (afterDecryptReply.equals("yes")) {
				afterDecryptName = new String(decrypteddata_array[2].trim());
				afterDecryptBalanceBTC = new String(
						decrypteddata_array[3].trim());
				afterDecryptBalanceDKK = new String(
						decrypteddata_array[4].trim());

			}

			System.out
					.println("Step 10. AfterEncryption(client) splits to String array: "
							+ decrypteddata_array[0].trim()
							+ " "
							+ decrypteddata_array[1].trim());

		} else if (decrypteddata_array[0].trim().equals("confirmed")) {
			afterDecryptReply = new String(decrypteddata_array[0].trim());
			afterDecryptNewBalanceBTC = new String(
					decrypteddata_array[1].trim());
			afterDecryptNewBalanceDKK = new String(
					decrypteddata_array[2].trim());

		} else if (decrypteddata_array[0].trim().equals("TransferCompleted")) {
			afterDecryptReply = new String(decrypteddata_array[1].trim());

			if (afterDecryptReply.equals("YES")) {

				afterDecryptNewBalanceBTC = new String(
						decrypteddata_array[2].trim());
				afterDecryptNewBalanceDKK = new String(
						decrypteddata_array[3].trim());
			}
			System.out
					.println("Step 10. AfterEncryption(client) splits to String array: "
							+ decrypteddata_array[0].trim()
							+ " "
							+ decrypteddata_array[1].trim());

		} else if (decrypteddata_array[0].trim().equals("sent")) {
			afterDecryptReply = new String(decrypteddata_array[0].trim());
		}

	}

	public String getAfterDecryptReply() {
		return afterDecryptReply;
	}

	public String getAfterDecryptName() {
		return afterDecryptName;
	}

	public String getAfterDecryptBalanceBTC() {
		return afterDecryptBalanceBTC;
	}

	public String getAfterDecryptBalanceDKK() {
		return afterDecryptBalanceDKK;
	}

	public String getAfterDecryptNewBalanceBTC() {
		return afterDecryptNewBalanceBTC;
	}

	public String getAfterDecryptNewBalanceDKK() {
		return afterDecryptNewBalanceDKK;
	}

}
